Field of the Invention
Embodiments provide methods for managing a flash memory that is comprised by a communication device that can be connected to a host and onto which data to be stored are written for mass storage. The invention further pertains to a computer program product for executing such a method.
Background of the Related Art
Mass storage devices can be a USB memory stick (USB: Universal Serial Bus), memory cards, e.g., for digital cameras, mobile telephones, or multi-media playback devices, or in the form of an SSD (SSD: Solid State Disk). A mass storage device includes a unit with the function of a memory controller and one or more non-volatile memory chips. Memory chips can be so-called flash EEPROM (Electrically Erasable Programmable Read-Only Memory) semiconductor memories, which need no power supply to maintain stored information. There are various flash types, which differ depending on the architecture and memory method chosen. Architecture hereinafter is understood to mean the arrangement of storage cells in the memory chip. The chosen memory method hereinafter is understood to mean the number of voltage levels used for storage within a storage cell. Examples of flash types are NOR Flash, NAND SLC (Single-Level Cell), or NAND MLC (Multi-Level Cell).
In order to write data to the flash memory chips, also known as flash memory, the storage units to be written to must first be erased. Erasing the individual storage units, each of which includes at least one storage cell for storing one bit that can have the logical value “0” or “1”, is possible only in areas larger than the written areas, so called blocks, also called erase blocks. A block hereinafter is defined as the smallest volume in bytes on the flash memory that can be erased only as a unit. One block includes 2z bytes (z>13). Typical block sizes for storing data in kbytes are 8, 16, 32, 64, 128, or 256 kb. The unit for writing to or writing on storage cells of the flash memory that is smaller than a block, also called a write unit or page, is defined as the smallest volume in bytes on the flash memory that can only be written as a unit. The size of the blocks, also called erase units, and of the write units depends on the type and size of the flash EEPROM. A NOR flash has block sizes between 8 kb and 256 kb, typically 64 kb, wherein a write unit is 1 byte. Smaller NANO flash memories are available with a block size of 16 kb for a write unit of one page with 512 bytes. Larger NAND flash memories with 128, 512, or 2048 kb block sizes use pages with a (page) size of 2, 4, or 8 kb. The maximum possible number of erase and write operations per unit is limited according to technical factors and depends on the type of flash memory. Erasing sets the individual bits in the memory chip to the value of “1,” while writing sets the bits to the value of “0.” In order to achieve uniform “wear” and lifespans of the individual memory locations, all bits are programmed to the value of “0” before erasing, so that they can then be set to the value of “1” when erasing occurs. Thus, smaller NAND flash memories are written in write units with 512 bytes while only erased in blocks of 16,384 bytes (16 kb). The smallest data volume used by the host or host system when writing depends on the size of a sector, which is defined as the smallest unit processed all at once in a host's or host system's file system. A working memory and/or flash memory is able to process, at least in principle, a sub-area of this smallest unit of a sector. Sectors include memory sizes of 2z bytes with z>3, typically 512 bytes. If one wishes to equip a USB mass storage device, such as a USB memory stick, with flash memories, one encounters the aforementioned problem of asymmetrical memory sizes for erasing and writing, because common file systems, such as FAT (File Allocation Table), FAT32, etc., use sectors with a 512 byte size, which corresponds to the size of the write unit in a smaller NAND flash memory.